package com.leo.springbootmultithreadbasic.volatilekey;

/**
 * @author Leo
 * @version V1.0
 */
public class MainDemo {
    public static void main(String[] args) throws InterruptedException {
        test();
    }

    public static void test() throws InterruptedException {
        Thread thread = new MyThread();
        thread.start();

        Thread.sleep(1000);

        ((MyThread) thread).setRunning(false);

        System.out.println("isRunning已经被赋值false了");
    }
}
